bitkeeper revision 1.1691.1.2 (42a6ae59pOLKl7oBFyH6Ukzy7yg3EA)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 8 Jun 2005 08:37:45 +0000 (08:37 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 8 Jun 2005 08:37:45 +0000 (08:37 +0000)
read/write control-reg macros are now same in xenlinux as native linux.
Signed-oiff-by: Keir Fraser <keir@xensource.com>
linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/system.h
linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/system.h

index 7fe4f04d1f574be11c5dc7fad5c33796f77015ec..22e41ce4122b6c2f0c605d506273be33d15f167d 100644 (file)
@@ -107,14 +107,25 @@ static inline unsigned long _get_base(char * addr)
  * Clear and set 'TS' bit respectively
  */
 #define clts() (HYPERVISOR_fpu_taskswitch(0))
-#define read_cr0() \
-       BUG();
+#define read_cr0() ({ \
+       unsigned int __dummy; \
+       __asm__( \
+               "movl %%cr0,%0\n\t" \
+               :"=r" (__dummy)); \
+       __dummy; \
+})
 #define write_cr0(x) \
-       BUG();
-#define read_cr4() \
-       BUG();
+       __asm__("movl %0,%%cr0": :"r" (x));
+
+#define read_cr4() ({ \
+       unsigned int __dummy; \
+       __asm__( \
+               "movl %%cr4,%0\n\t" \
+               :"=r" (__dummy)); \
+       __dummy; \
+})
 #define write_cr4(x) \
-       BUG();
+       __asm__("movl %0,%%cr4": :"r" (x));
 #define stts() (HYPERVISOR_fpu_taskswitch(1))
 
 #endif /* __KERNEL__ */
index 8d4d9e32ac293664933a37dd4546d6ca3ea67482..e8badb7533b57e6e02d676853d6e200aa015afb8 100644 (file)
@@ -145,30 +145,38 @@ struct alt_instr {
  * Clear and set 'TS' bit respectively
  */
 #define clts() (HYPERVISOR_fpu_taskswitch(0))
+
 static inline unsigned long read_cr0(void)
 { 
-       return 0;
+       unsigned long cr0;
+       asm volatile("movq %%cr0,%0" : "=r" (cr0));
+       return cr0;
 } 
 
 static inline void write_cr0(unsigned long val) 
 { 
-       /* Ignore, Linux tries to clear TS and EM */
+       asm volatile("movq %0,%%cr0" :: "r" (val));
 } 
 
 static inline unsigned long read_cr3(void)
 { 
-        BUG();
+       unsigned long cr3;
+       asm("movq %%cr3,%0" : "=r" (cr3));
+       return cr3;
 } 
 
 static inline unsigned long read_cr4(void)
 { 
-        BUG();
+       unsigned long cr4;
+       asm("movq %%cr4,%0" : "=r" (cr4));
+       return cr4;
 } 
 
 static inline void write_cr4(unsigned long val)
 { 
-        BUG();
+       asm volatile("movq %0,%%cr4" :: "r" (val));
 } 
+
 #define stts() (HYPERVISOR_fpu_taskswitch(1))
 
 #define wbinvd() \